<?php

class Application_Form_Register extends Zend_Form {

    public function init() {
        $passwordConfirmation = new My_Plugin_PasswordConfirmation();
        $emailConfirmation = new My_Plugin_EmailConfirmation();

        $this->addElement('text', 'email', array(
            'label' => 'Adres e-mail:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StringToLower',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                $emailConfirmation,
                'EmailAddress',
                'NotEmpty',
            )
        ));

        $this->addElement('text', 'email_confirm', array(
            'label' => 'Powtórz adres e-mail:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StringToLower',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                $emailConfirmation,
                'EmailAddress',
                'NotEmpty',
            )
        ));

        $this->addElement('password', 'password', array(
            'label' => 'Hasło:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                $passwordConfirmation,
                'NotEmpty',
                array('StringLength', false, array(8, 100)),
            )
        ));

        $this->addElement('password', 'password_confirm', array(
            'label' => 'Powtórz hasło:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                $passwordConfirmation,
                'NotEmpty',
                array('StringLength', false, array(8, 100)),
            )
        ));

        $this->addElement('text', 'imie', array(
            'label' => 'Imię:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                'NotEmpty',
                array('StringLength', false, array(2, 100)),
            )
        ));

        $this->addElement('text', 'nazwisko', array(
            'label' => 'Nazwisko:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                'NotEmpty',
                array('StringLength', false, array(2, 100)),
            )
        ));

        $this->addElement('text', 'firma', array(
            'label' => 'Firma:',
            'required' => true,
            'filters' => array(
                'StringTrim',
                'StripNewlines',
                'StripTags',
            ),
            'validators' => array(
                'NotEmpty',
                array('StringLength', false, array(2, 100)),
            )
        ));

        $this->addElement('captcha', 'captcha', array(
            'label' => 'Potwierdź autentyczność:',
            'required' => true,
            'captcha' => array(
                'captcha' => 'ReCaptcha',
                'privKey' => '6LeKx7sSAAAAAAeJCkcmBFujuzztBmqaoLjFtYUt',
                'pubKey' => '6LeKx7sSAAAAAHTd_3T13KOvHZgtygNUOax1H5E6'
            )
        ));

        $this->addElement('submit', 'zarejestruj');
    }

}
